package com.xique.blelock.model;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

import com.xique.blelock.Utils.Stringkey;

import java.io.Serializable;

/**
 * Created by Administrator on 2018/12/12.
 */

public class UserOfLockinfo implements Serializable, Parcelable, Comparable<UserOfLockinfo> {
//    	"uid": "f9a8a6ab1c8a48ceaf4026e93b1ac53e",
//                "order": 1,
//                "role": 0,
//                "nickname": "地方嘤嘤嘤"

    private String uid;
    private int order;
    private  int role;
    private String nickname;

    private String lockId;

    //辅助swipemenu  记录当前有几个自菜单

    private int menunum;

    public UserOfLockinfo() {
    }


    protected UserOfLockinfo(Parcel in) {
        uid = in.readString();
        order = in.readInt();
        role = in.readInt();
        nickname = in.readString();
        lockId = in.readString();
    }


    public int getMenunum() {
        return menunum;
    }

    public void setMenunum(int menunum) {
        this.menunum = menunum;
    }

    public static final Creator<UserOfLockinfo> CREATOR = new Creator<UserOfLockinfo>() {
        @Override
        public UserOfLockinfo createFromParcel(Parcel in) {
            return new UserOfLockinfo(in);
        }

        @Override
        public UserOfLockinfo[] newArray(int size) {
            return new UserOfLockinfo[size];
        }
    };

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public int getOrder() {
        return order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    public int getRole() {
        return role;
    }

    public void setRole(int role) {
        this.role = role;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getLockId() {
        return lockId;
    }

    public void setLockId(String lockId) {
        this.lockId = lockId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserOfLockinfo that = (UserOfLockinfo) o;

        return uid.equals(that.uid);
    }

    @Override
    public int hashCode() {
        return uid.hashCode();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {

        dest.writeString(uid);
        dest.writeInt(order);
        dest.writeInt(role);
        dest.writeString(nickname);
        dest.writeString(lockId);
    }


    @Override
    public int compareTo(@NonNull UserOfLockinfo o) {
        return this.role - o.getRole();
    }
}
